<!-- 危化品管理-危废品库存-存放报警设定 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="8">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="危废桶">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
         

          <template v-if="showAll">
          
            <el-col :span="6">
            <el-form-item label="空气项目">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="报警说明">
              <el-input v-model="listQuery.fuser" placeholder="报警说明" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
          <el-form-item label="状态">
            <el-select v-model="listQuery.fcustomno" placeholder="请选择"
              :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                v-for="item in options3"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          </el-col>

          </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <!-- <el-button type="success" icon="el-icon-download">导出</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FBILLNO" label="单号"></el-table-column>
          <el-table-column prop="FBILLCREDATE" label="设定日期" width="95"></el-table-column>
          <el-table-column prop="FTNAME" label="危废桶名称"  width="85"></el-table-column>
          <el-table-column prop="FCATNAME" label="空气项目"  width="95"></el-table-column>
          <el-table-column prop="FMINVALUE" label="起始值"  width="75"></el-table-column>
          <el-table-column prop="FMAXVALUE" label="结束值"  width="75"></el-table-column>
          <el-table-column prop="FMEMO" label="报警说明" ></el-table-column>
          <!-- <el-table-column prop="FEMAIL" label="发送邮件"  width="85"></el-table-column> -->
          <!-- <el-table-column prop="FMESSAGE" label="发送短信"  width="85" ></el-table-column> -->
          <el-table-column prop="FLEVEL" label="风险等级"  width="85"></el-table-column>
          <el-table-column prop="FBILLSTATE" label="状态"  width="95"></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="150">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                编辑
              </el-button>

              <el-popconfirm title="确定发布当前预约吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-s-check" style="color: red;margin-left: 10px;"
                  type="text">发布</el-button>
              </el-popconfirm>

            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '室外:PM2.5'
        }, {
          value: '2',
          label: '室外:PM10'
        }, {
          value: '3',
          label: '室内:温度'
        }],

        options2: [{
          value: '1',
          label: '锃盛防爆废料垃圾桶'
        }, {
          value: '2',
          label: '危废化学品盛漏油桶'
        }, {
          value: '3',
          label: '有毒物质密封桶'
        }],

        options3: [{
          value: '1',
          label: '未确认'
        }, {
          value: '2',
          label: '已确认'
        }, {
          value: '3',
          label: '已作废'
        }],

        customlist:[
          {
            "FBILLNO": "K241130001", 
            "FBILLCREDATE":"2024-11-29",
            "FCATNAME": "室外:PM2.5",
            "FMINVALUE":"125",
            "FMAXVALUE":"9999",
            "FMEMO":"室外环境不适合开展户外活动",
            "FEMAIL":"是",
            "FMESSAGE":"是",
            "FLEVEL":"中风险",
            "FBILLSTATE": "正常"
          },
        ],
        list: [
            {
            "FBILLNO": "K241130001", 
            "FBILLCREDATE":"2024-11-29",
            "FCATNAME": "室外:PM2.5",
            "FMINVALUE":"125",
            "FMAXVALUE":"9999",
            "FMEMO":"室外环境不适合开展户外活动",
            "FEMAIL":"是",
            "FMESSAGE":"是",
            "FLEVEL":"中风险",
            "FTNAME":"锃盛防爆废料垃圾桶",
            "FBILLSTATE": "正常"
            },{
            "FBILLNO": "K241130002", 
            "FBILLCREDATE":"2024-11-29",
            "FCATNAME": "室外:PM10",
            "FMINVALUE":"125",
            "FMAXVALUE":"9999",
            "FMEMO":"室外环境不适合开展户外活动",
            "FEMAIL":"是",
            "FMESSAGE":"是",
            "FLEVEL":"中风险",
            "FTNAME":"危废化学品盛漏油桶",
            "FBILLSTATE": "正常"
            },
            ,{
            "FBILLNO": "K241130003", 
            "FBILLCREDATE":"2024-11-29",
            "FCATNAME": "室内:温度",
            "FMINVALUE":"30",
            "FMAXVALUE":"39",
            "FMEMO":"需要打开教室新风系统",
            "FEMAIL":"是",
            "FMESSAGE":"是",
            "FLEVEL":"中风险",
            "FTNAME":"有毒物质密封桶",
            "FBILLSTATE": "正常"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>